package com.x.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.Locale;

/**
 * the class of advance
 *
 * <p>
 * .
 *
 * @author little_lunatic
 * @date 2024-08-23
 */
@RestController
public class LanguageController {

    @Autowired
    private MessageSource messageSource;

    @GetMapping("i18n/dis_{language}")
    public String getValue(@PathVariable(value = "language", required = false) String language){
        return messageSource.getMessage("hello", null, new Locale(language, ""));
    }
}
